<?php

class Admin_Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected $_name = 'admin';

    function _initAcl() 
    {
        $registry = Zend_Registry::getInstance();
        $acl = $registry->get('acl');
        $this->_initIndexAcl($registry,$acl);  
        $this->_initConfigAcl($registry,$acl);
    }
    private function _initIndexAcl($registry,$acl)
    {
        $resource_name = $this->_name . ':index';
        $acl->addResource($resource_name);
        $arrGuest = array(
                'index',            
        );
        $arrUser = array_merge(
                        array(
                            'config'
                        ), $arrGuest
        );        
        $acl->allow(Core_Role::ROLE_GUEST, $resource_name, $arrGuest);
        $acl->allow(Core_Role::ROLE_USER, $resource_name, $arrUser);		
        $registry->set('acl',$acl);
    }

    private function _initConfigAcl($registry,$acl)
    {
        $resource_name = $this->_name . ':config';
        $acl->addResource($resource_name);
        $arrGuest = array(
                'index',
        );
        $arrUser = array_merge(
                        array(					
                                'fans',                                                                
                                'nonfans',
                                
                        ), $arrGuest
        );        
        $acl->allow(Core_Role::ROLE_GUEST, $resource_name, $arrGuest);
        $acl->allow(Core_Role::ROLE_USER, $resource_name, $arrUser);
        $registry->set('acl',$acl);
    }
    
}

